from common.unit import AndroidUI


# 回收界面,科室装袋
class RecoverBagObject:

    def __init__(self):
        self.driver = AndroidUI.get_webdriver()

    # 登录信息
    def login_name(self):
        element = self.driver(resourceId="com.bluephone:id/login_name_text")
        return element

    # 注销按钮
    def quit_button(self):
        element = self.driver(resourceId="com.bluephone:id/syncAndLogout")
        return element

    # 重启蓝牙
    def restart_bluetooth_button(self):
        element = self.driver(resourceId="com.bluephone:id/restart_bluetooth")
        return element

    # 置零
    def clear_zero_button(self):
        element = self.driver(resourceId="com.bluephone:id/clear_zero")
        return element

    # 科室认证按钮
    def department_button(self):
        element = self.driver(resourceId="com.bluephone:id/depart_name")
        # com.bluephone: id / depart_name
        return element

    # 护士认证按钮
    def nurse_button(self):
        element = self.driver(resourceId="com.bluephone:id/doctors_name")
        return element

    # 扫描标签码后显示的重量
    def recover_info(self):
        element = self.driver(resourceId="com.bluephone:id/prompt_text")
        return element

    # 扫描垃圾袋标签吗后，点击类型进行回收时候的那个按钮
    def recover_button(self):
        element = self.driver(resourceId="com.bluephone:id/typeStr")
        return element

    # 用来确认是否到输入重量弹窗
    def confirm_weight(self):
        element = self.driver(resourceId="com.bluephone:id/md_title")
        return element

    #用于判断是否有扫描医废标签的弹窗
    def choice_text(self):
        element = self.driver(text='请选择垃圾类别')
        return element

    # 重量输入框
    def input_box(self):
        element = self.driver(resourceId="android:id/input")
        return element

    # 输入重量弹窗的那个确定按钮
    def weight_ok_button(self):
        element = self.driver(resourceId="com.bluephone:id/md_buttonDefaultPositive")
        return element

    #列表中的删除医废按钮，index从1开始，1是最上面的那条
    def del_button(self,index):
        xpath=(f'//*[@resource-id="com.bluephone:id/list_data"]/android.widget.LinearLayout[{index}]/android.widget.LinearLayout[1]/android.widget.ImageView[1]')
        element = self.driver.xpath(xpath)
        return element

    #删除医废的那个确定按钮
    def del_ok_button(self):
        element = self.driver(resourceId="com.bluephone:id/prompt_right_btn")
        return element

    #删除医废的那个取消按钮
    def del_cancel_button(self):
        element = self.driver(resourceId="	com.bluephone:id/prompt_left_btn")
        return element

    # 实时重量
    def weight_button(self):
        element = self.driver(resourceId="com.bluephone:id/date_text")
        return element

    # 总重量
    '''
    总重(KG):
    0.00
    '''

    def total_weight(self):
        element = self.driver(resourceId="com.bluephone:id/weight_total")
        return element

    # 实时重量
    '''
    实时(KG):
    0.13
    '''

    def real_weight(self):
        element = self.driver(resourceId="com.bluephone:id/date_text")
        return element

    # 输入重量
    def weight_input(self):
        element = self.driver(resourceId="android:id/input")
        return element


    # 垃圾袋列表
    def list_data(self):
        element = self.driver(resourceId="com.bluephone:id/list_data")
        return element


    # 返回按钮
    def back_button(self):
        element = self.driver(resourceId="com.bluephone:id/iv_back")
        return element


if __name__ == '__main__':
    pass
